function concaturl(url) {
  return `${window.RPConfig.mgt}/export/${url}`;
}

export const getRoleList = ({ responseProcess, param, initParam }) => {
  const { condition } = initParam;
  const _param = Object.assign({}, param, condition);
  $http.post(concaturl(`role/page`), _param).then(res => {
    responseProcess(res.data.data)
  });
};

export const getHistoryList = ({ responseProcess, param, initParam }) => {
  const { condition } = initParam;
  const _param = Object.assign({}, param, { condition });
  $http.post(concaturl(`batch/list`), _param).then(res => responseProcess(res.data));
};

export const getRuleList = () => $http.post(concaturl("role/list"), {});

export const deleteRule = id => $http.post(concaturl("role/delete?id=" + id));

export const saveRule = params => $http.post(concaturl(`role/${params.id ? "update" : "save"}`), params);

export const updateRule = params => $http.post(concaturl("role/update"), params);

export const getTempList = param => $http.post(concaturl("data/page"), param);

export const deleteTempData = id => $http.post(concaturl("data/deleteByIds"), [id]);

export const saveTempData = params => $http.post(concaturl("data/batchSave"), params);

export const updateTempData = params => $http.post(concaturl("data/batchUpdate"), params);

export const checkTempData = id => $http.post(concaturl("data/check?batchId=" + id));

export const importTempData = id => $http.post(concaturl("data/import?batchId=" + id));
